Page({
  data: {
    categories: [
      { id: 1, name: '热销', icon: '/images/hot.png' },
      { id: 2, name: '新品', icon: '/images/new.png' },
      { id: 3, name: '套餐', icon: '/images/combo.png' },
      { id: 4, name: '饮品', icon: '/images/drink.png' },
      { id: 5, name: '甜点', icon: '/images/dessert.png' }
    ],
    recommendFoods: [
      {
        id: 1,
        name: '招牌炒饭',
        price: 28,
        image: '/images/food1.jpg'
      },
      {
        id: 2,
        name: '香辣鸡翅',
        price: 32,
        image: '/images/food2.jpg'
      },
      {
        id: 3,
        name: '水果沙拉',
        price: 22,
        image: '/images/food3.jpg'
      },
      {
        id: 4,
        name: '奶茶',
        price: 15,
        image: '/images/food4.jpg'
      }
    ]
  },

  onLoad: function() {
    // 页面加载时的逻辑
  },

  onSearch: function(e) {
    const keyword = e.detail.value;
    // 实现搜索逻辑
    console.log('搜索关键词：', keyword);
  },

  onCategoryTap: function(e) {
    const categoryId = e.currentTarget.dataset.id;
    // 处理分类点击事件
    console.log('点击分类：', categoryId);
  },

  onFoodTap: function(e) {
    const foodId = e.currentTarget.dataset.id;
    // 处理菜品点击事件
    console.log('点击菜品：', foodId);
  }
}) 